package com.lzy.huijinjiazu.mvp.ui.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.flyco.tablayout.listener.OnTabSelectListener;
import com.flyco.tablayout.utils.FragmentChangeManager;
import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;

import com.lzy.huijinjiazu.di.component.DaggerJoinComponent;
import com.lzy.huijinjiazu.di.module.JoinModule;
import com.lzy.huijinjiazu.mvp.contract.JoinContract;
import com.lzy.huijinjiazu.mvp.presenter.JoinPresenter;

import com.lzy.huijinjiazu.R;

import java.util.ArrayList;

import butterknife.BindView;

import static com.jess.arms.utils.Preconditions.checkNotNull;


public class JoinFragment extends BaseFragment<JoinPresenter> implements JoinContract.View {

    private FragmentChangeManager mFragmentChangeManager;

    public static JoinFragment newInstance() {
        JoinFragment fragment = new JoinFragment();
        return fragment;
    }

    @Override
    public void setupFragmentComponent(AppComponent appComponent) {
        DaggerJoinComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .joinModule(new JoinModule(this))
                .build()
                .inject(this);
    }

    @Override
    public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_join, container, false);
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        initFragment();
    }

    private void initFragment() {
        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add(IWantJoinFragment.newInstance());
        fragments.add(MyAssetsFragment.newInstance());
        mFragmentChangeManager = new FragmentChangeManager(this.getChildFragmentManager(), R.id.fl_content, fragments);
        mFragmentChangeManager.setFragments(1);
    }


}
